package com.sxs.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sxs.dao.UserDao;
import com.sxs.entity.UserDO;
import com.sxs.service.UserService;

import javax.annotation.Resource;

/**
 * @author songXuSheng
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;

    @Override
    public UserDO findById(String id) {
        System.out.println("调用provider中的findById方法。。。");
        return userDao.selectById(id);
    }

    @Override
    public Integer addUserDO(UserDO user) {
        System.out.println("调用provider中的addUserDO方法。。。");
        return userDao.insert(user);
    }

    @Override
    public Page<UserDO> listUser(Long current, Long limit) {
        System.out.println("调用provider中的listUser方法。。。");
        Page<UserDO> page=new Page<>(current,limit);
        return userDao.selectPage(page, null);
    }

    @Override
    public Integer delete(String id) {
        System.out.println("调用provider中的delete方法。。。");
        return userDao.deleteById(id);
    }

    @Override
    public Integer update(UserDO user) {
        System.out.println("调用provider中的update方法。。。");
        return userDao.updateById(user);
    }
}
